using System;
using System.Data;
using digit.Core;

namespace SMS.ServiceManager
{
    public class MessageInData
    {
        #region CONSTRUCTORS
        public MessageInData(string connectionString)
        {
            this.m_connectionString = connectionString;
        }
        #endregion

        #region ATTRIBUTES
        const string SQL_INSERT = "vn1102_Insert_MessageIn";
        const string SQL_UPDATE = "vn1102_Update_MessageIn";
        const string SQL_DELETE = "vn1102_Delete_MessageIn";
        const string SQL_SELECTONE = "vn1102_Select_MessageIn";
        const string SQL_SELECTALL = "vn1102_SelectAll_MessageIn";
        const string SQL_SEARCH = "vn1102_Search_MessageIn";
        private string m_connectionString;
        #endregion

        #region METHODS
        public bool Insert(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_INSERT, values);
            return i > 0;
        }

        public bool Update(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_UPDATE, values);
            return i > 0;
        }

        public bool Delete(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_DELETE, values);
            return i > 0;
        }

        public DataTable Select(object[] values)
        {
            return DataAccess.FillTable(this.m_connectionString, SQL_SELECTONE, values, true);
        }

        public DataTable SelectAll()
        {
            return DataAccess.FillTable(this.m_connectionString, SQL_SELECTALL, true);
        }

        public DataTable SelectByServiceID(string serviceId)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Select_MessageIn_ByServiceID", serviceId, true);
        }

        public DataTable StatisticMsgIn_ByServiceID_Online(string serviceId)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_ByServiceID_Online", serviceId, true);
        }

        public DataTable StatisticMsgIn_ByService_Online(string service)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_ByService_Online", service, true);
        }

        public DataTable SearchMsgIn_ByServiceID_Online(object[] values)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Search_MsgInByServiceID_Online", values, true);
        }

        public DataTable StatisticMsgIn_ByServiceID(string serviceId)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_ByServiceID", serviceId, true);
        }

        public DataTable StatisticMsgIn_ByService(string service)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_ByService", service, true);
        }

        public DataTable StatisticMsgIn_ByBet(object[] values)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_Bet_Online", values, true);
        }

        public DataTable StatisticMsgInError_ByEdit(string userName)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Statistics_MessageIn_Error_Edit", userName, true);
        }

        public DataTable GetSystemVars(string serviceId)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_GetSystemVars_All", serviceId, true);
        }

        public DataTable GetSystemVars996()
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_GetSystemVars_996", true);
        }

        public DataTable SelectAll_MessageError()
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_SelectAll_MessageIn_Error", true);
        }

        public DataTable SelectAll_MessageError_ByServiceID(object[] values)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_SelectAll_MsgIn_Error_ByServiceID", values, true);
        }

        public DataTable SelectAll_Network_ByServiceID(string serviceId)
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Select_AllNetwork_MsgIn_ByServiceID", serviceId, true);
        }

        public DataTable SelectAll_MessageProcess()
        {
            return DataAccess.FillTable(this.m_connectionString, "vn1102_Select_All_MessageIn_Process", true);
        }

        public bool UpdateStatus(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MessageIn_Status", values);
            return i > 0;
        }

        public bool UpdateError(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MessageIn_Error", values);
            return i > 0;
        }

        public bool UpdateError80(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_80_Error", values);
            return i > 0;
        }

        public bool UpdateError81(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_81_Error", values);
            return i > 0;
        }

        public bool UpdateError82(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_82_Error", values);
            return i > 0;
        }

        public bool UpdateError83(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_83_Error", values);
            return i > 0;
        }

        public bool UpdateError84(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_84_Error", values);
            return i > 0;
        }

        public bool UpdateError85(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_85_Error", values);
            return i > 0;
        }

        public bool UpdateError86(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_86_Error", values);
            return i > 0;
        }

        public bool UpdateError87(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MsgIn_87_Error", values);
            return i > 0;
        }

        public bool UpdateWaitingService()
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_WaitingService");
            return i > 0;
        }

        public bool MoveError(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Move_MessageIn_Error", values);
            return i > 0;
        }

        public bool DeleteError(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Delete_MessageIn_Error", values);
            return i > 0;
        }

        public bool UpdateReturnProcess(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Update_MessageIn_ReturnProcess", values);
            return i > 0;
        }

        public bool InsertError(string Error)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "vn1102_Insert_ProcessInLogs", Error);
            return i > 0;
        }

        #endregion

    }
}